﻿<!DOCTYPE html>
<html lang="zh" xmlns="http://www.w3.org/1999/html">
<head>
    <meta charset="UTF-8"/>
    <title>管理员登录</title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <meta
            name="viewport"
            content="width=device-width, initial-scale=1, maximum-scale=1"
    />
    <meta http-equiv="X-UA-Compatible" content="IE=Edge"/>
    <link rel="stylesheet" href="../amis/antd.css"/>
    <link rel="stylesheet" href="../amis/helper.css"/>
    <link rel="stylesheet" href="../amis/iconfont.css"/>
    <style>
        html,
        body,
        .app-wrapper {
            position: relative;
            width: 100%;
            height: 100%;
            margin: 0;
            padding: 0;
        }
    </style>
</head>
<body>
<div id="root" class="app-wrapper"></div>
<script src="../amis/sdk.js"></script>
<script type="text/javascript">
    (function () {
        let amis = amisRequire('amis/embed');
        // 通过替换下面这个配置来生成不同页面
        let amisJSON = {
                "type": "page",
                "body": {
                    "type": "flex",
                    "items": [
                        {
                            type: "container",
                            "style": {
                                "backgroundColor": "#1A5CFF",
                                "width": 400,
                                "height": 50,
                                "margin": "10% auto"
                            },
                            body: {
                                "type": "form",
                                "title": "<div style='text-align: center;'><h2 style=' font-weight: bold;'>山东营养源<br>微信信息管理系统 登录</h3></div>",
                                "mode": "horizontal",
                                "api": {
                                    "url": "/api/adminuser/login",
                                    "method": "post",
                                    adaptor: function (payload, response) {
                                        // console.log(payload, response);
                                        if (payload.status == 0) {
                                            console.log(payload.data.token);
                                            localStorage.setItem('token', payload.data.token);
                                            localStorage.setItem('xtoken', payload.data.xtoken);
                                        }
                                        return payload;
                                    }
                                },
                                "redirect": "/admin/index.html",
                                "horizontal": {
                                    "leftFixed": "sm"
                                },
                                "body": [
                                    {
                                        "type": "input-text",
                                        "name": "UserName",
                                        "label": "用户名",
                                        "required": true
                                    },
                                    {
                                        "type": "input-password",
                                        "name": "PassWord",
                                        "required": true,
                                        "label": "密码"
                                    }
                                ]
                            }
                        }
                    ]
                }
            }
        ;
        let amisScoped = amis.embed('#root', amisJSON, {}, {theme: 'antd'});
    })
    ();
</script>
</body>
</html>